﻿using RpcCacheClient;
using RpcCacheClient.Interface;
using RpcClient.Interface;

namespace RpcCacheModular
{
    [RpcClient.Attr.ClassLifetimeAttr(RpcClient.Attr.ClassLifetimeType.单例)]
    internal class CacheExtendService : IExtendService
    {
        private IRpcCacheConfig _Config;
        public CacheExtendService(IRpcCacheConfig config)
        {
            _Config = config;
        }
        public string Name => "CacheService";

        public void Load(IRpcService service)
        {
            service.InitComplating += this.Service_InitComplating;
        }



        private void Service_InitComplating()
        {
            RpcCacheService.Init(this._Config.Cache, this._Config.CacheType);
        }
    }
}
